/**
 * 
 */
package org.chengsen.config;

import java.util.Properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
 * hibernate 配置的 java 实现
 * 
 * @author Jason.zhang
 * 
 */
@Configuration
@ImportResource("classpath:property/hibernate.properties")
public class HibernateConfig {
	@Value("${hibernate.dialect}")
	private String dialect;
	@Value("${hibernate.hbm2ddl.auto}")
	private String hbm2ddl;
	@Value("${hibernate.show_sql}")
	private String showSql;

	@Bean(name = "hibernateProperties")
	public Properties hibernateProperties() {
		Properties properties = new Properties();
		properties.setProperty("hibernate.dialect", dialect);
		properties.setProperty("hibernate.hbm2ddl.auto", hbm2ddl);
		properties.setProperty("hibernate.show_sql", showSql);
		return properties;
	}
}
